﻿<Window x:Class="HostEdit.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Host edit" Height="528" Width="619" 
        xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification" Icon="/HostEdit;component/Images/options-parametres-icone-5311-32.ico"
        Closing="Window_Closing"
        Closed="Window_Closed"
        StateChanged="Window_StateChanged"
        Loaded="Window_Activated">
    <Window.Resources>
        <DrawingImage x:Key="PlayImage">
            <DrawingImage.Drawing>
                <DrawingGroup>
                    <DrawingGroup.Children>
                        <GeometryDrawing Brush="Green" Geometry="F1 M 50,25L 0,0L 0,50L 50,25 Z "/>
                    </DrawingGroup.Children>
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
        <DrawingImage x:Key="StopImage">
            <DrawingImage.Drawing>
                <DrawingGroup>
                    <DrawingGroup.Children>
                        <GeometryDrawing Brush="Gray" Geometry="F1 M 0,0L 50,0L 50,50L 0,50L 0,0 Z "/>
                    </DrawingGroup.Children>
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
    </Window.Resources>
    <!--<Window.CommandBindings>
        <CommandBinding Command="MediaCommands.Play"
                  Executed="CommandBinding_Executed"
                  CanExecute="CommandBinding_CanExecute_1"/>
        <CommandBinding Command="MediaCommands.Stop"
                  Executed="CommandBinding_Executed_1"
                  CanExecute="CommandBinding_CanExecute"/>
    </Window.CommandBindings>-->
    <!--<Window.TaskbarItemInfo>
        <TaskbarItemInfo x:Name="taskBarItemInfo1" 
                     Overlay="{StaticResource ResourceKey=StopImage}"
                     ThumbnailClipMargin="80,0,80,140"
                     Description="Taskbar Item Info Sample">
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfoCollection>
                    <ThumbButtonInfo
                    DismissWhenClicked="False"
                    Command="MediaCommands.Play"
                    CommandTarget="{Binding ElementName=btnPlay}"
                    Description="Play"
                    ImageSource="{StaticResource ResourceKey=PlayImage}"/>
                    <ThumbButtonInfo
                    DismissWhenClicked="True"
                    Command="MediaCommands.Stop"
                    CommandTarget="{Binding ElementName=btnStop}"
                    Description="Stop"
                    ImageSource="{StaticResource ResourceKey=StopImage}"/>
                </ThumbButtonInfoCollection>
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Window.TaskbarItemInfo>-->
    
    <Grid>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <tb:TaskbarIcon x:Name="taskicon"
                              
            MenuActivation="LeftOrRightClick"
            ToolTipText="Host Editor" 
            IconSource="/HostEdit;component/Images/options-parametres-icone-5311-32.ico">

           
            
            <tb:TaskbarIcon.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Show" Click="MenuItem_Click" />
                    <MenuItem Header="Close" Click="MenuItem_Click_1" />
                    <Separator />
                </ContextMenu>
            </tb:TaskbarIcon.ContextMenu>


        </tb:TaskbarIcon>
        
        <ToolBar Grid.Row="0" Margin="0,0,0,20" Band="1" >

            <Button Click="Button_Click_12" Margin="7,0,0,0" ToolTip="Fermer">
                <Image Width="16" Height="16" Source="/HostEdit;component/Images/sortie-icone-6793-32.png" />
            </Button>
            
            <Button Click="Button_Click" Margin="7,0,0,0" ToolTip="Ecrire dans le host">
                <Image Width="16" Height="16" Source="/HostEdit;component/Images/adobe-concepteur-icone-9814-32.png" />
            </Button>

            <Button Click="Button_Click_1" Margin="7,0,0,0" ToolTip="ajouter un host au model">
                <Image Width="16" Height="16" Source="/HostEdit;component/Images/ajouter-icone-5107-32.png" />
            </Button>

            <Label Margin="40,0,0,0" Content="Model : " />

            <ComboBox Margin="7,0,0,0" Width="200" x:Name="LstListeContext" SelectionChanged="LstListeContext_SelectionChanged" DisplayMemberPath="Name" />

            <Button  Margin="7,0,0,0" Click="Button_Click_8" ToolTip="Ajouter un nouveau model">
                <Image Width="16" Height="16" Source="/HostEdit;component/Images/ajouter-icone-5107-32.png" />
            </Button>

            <Button  Margin="7,0,0,0" Click="Button_Click_10" ToolTip="Copier le model">
                <Image Width="16" Height="16" Source="/HostEdit;component/Images/editcopy-icone-7922-32.png" />
            </Button>

            <Button  Margin="7,0,0,0" Click="Button_Click_9" ToolTip="Supprimer le model en cours">
                <Image Width="16" Height="16" Source="/HostEdit;component/Images/deletered-icone-9104-32.png" />
            </Button>

            <Button Click="Button_Click_2" Margin="7,0,0,0" ToolTip="Sauver les models">
                <Image Width="16" Height="16" Source="/HostEdit;component/Images/3floppy-enregistrer-demonter-icone-7773-32.png" />
            </Button>                
            
            <!--<CheckBox x:Name="WindowsStart" Content="Start on windwos startup." Checked="CheckBox_Checked_1" />-->
            
        </ToolBar>
       
    
        <ListBox x:Name="LstHost" Grid.Row="1" ItemsSource="{Binding .}" >
            <ListBox.Background>
                <LinearGradientBrush
        EndPoint="0.673,0.95"
        StartPoint="0.274,0.137">
                    <GradientStop
          Color="#FFFFFFFF"
          Offset="0" />
                    <GradientStop
          Color="#FFB4C6D8"
          Offset="0.982" />
                </LinearGradientBrush>
            </ListBox.Background>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />                            
                            <ColumnDefinition Width="200" />
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        
                        <Button Grid.Column="0" Margin="5" Tag="{Binding .}" Click="Button_Click_3" VerticalAlignment="Top" ToolTip="Editer le nom du host" >
                            <Button.Template>
                                <ControlTemplate>
                                    <Image Width="16" Height="16" Source="/HostEdit;component/Images/edit-un-stylo-ecrire-icone-9494-16.png" />
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
                        <Button Grid.Column="1" Margin="5" Tag="{Binding .}" Click="Button_Click_5" VerticalAlignment="Top" ToolTip="Supprimer le host">
                            <Button.Template>
                                <ControlTemplate>
                                    <Image Width="16" Height="16" Source="/HostEdit;component/Images/deletered-icone-9104-32.png" />
                                </ControlTemplate>
                            </Button.Template>
                        </Button>                        
                        
                        <Label Grid.Column="2" Content="{Binding Name}" VerticalAlignment="Top" />                      
                        
                        <ListBox Grid.Column="3" ItemsSource="{Binding Address}" Margin="2" >
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="28" />
                                            <ColumnDefinition Width="20" />
                                            <ColumnDefinition Width="20" />
                                            <ColumnDefinition />
                                        </Grid.ColumnDefinitions>
                                        <CheckBox Margin="7" Grid.Column="0" IsChecked="{Binding Active}" Checked="CheckBox_Checked" Tag="{Binding .}" ToolTip="Placer en commentaire" />
                                        <Button Grid.Column="1" Tag="{Binding .}" Click="Button_Click_4" ToolTip="Editer l'adresse IP">
                                            <Button.Template>
                                                <ControlTemplate>
                                                    <Image Width="16" Height="16" Source="/HostEdit;component/Images/edit-un-stylo-ecrire-icone-9494-16.png" />
                                                </ControlTemplate>
                                            </Button.Template>
                                        </Button>
                                        <Button Grid.Column="2" Tag="{Binding .}" Click="Button_Click_7" ToolTip="Supprimer l'adresse IP">
                                            <Button.Template>
                                                <ControlTemplate>
                                                    <Image Width="16" Height="16" Source="/HostEdit;component/Images/deletered-icone-9104-32.png" />
                                                </ControlTemplate>
                                            </Button.Template>
                                        </Button>
                                        <Label Grid.Column="3" Content="{Binding Value}" Width="190" />
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>

                        <Button  Grid.Column="4" Margin="5" Tag="{Binding .}" Click="Button_Click_6" VerticalAlignment="Top" ToolTip="Ajouter une adresse IP">
                            <Button.Template>
                                <ControlTemplate>
                                    <Image Width="16" Height="16" Source="/HostEdit;component/Images/ajouter-icone-5107-32.png" />
                                </ControlTemplate>
                            </Button.Template>
                        </Button>

                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>       
    </Grid>
</Window>
